<template>
  <div class="order">
    <header>
      <i class="el-icon-arrow-left" @click="$router.go(-1)"></i>
      <div>订单</div>
      <i></i>
    </header>
    <div class="cardbox">
      <div class="block">
        <el-timeline>
          <el-timeline-item
            :timestamp="item.create"
            placement="top"
            v-for="(item, i) in carList"
            :key="i"
          >
            <el-card>
              <van-card
                v-for="(k, index) in item.shoplist"
                :key="index"
                :price="k.prices"
                :desc="k.desc"
                :title="k.title"
                :thumb="k.img"
              />
            </el-card>
          </el-timeline-item>
        </el-timeline>
      </div>
    </div>
  </div>
</template>

<script>
import Vue from "vue";
import { Card } from "vant";

Vue.use(Card);
import { getOrder } from "../../api/order";
export default {
  data() {
    return {
      carList: [],
    };
  },
  mounted() {
    getOrder(this.$store.state.user.userid).then((res) => {
      this.carList = res.data;
      console.log(res);
    });
  },
};
</script>

<style scoped>
.order {
  height: 100%;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
}
.cardbox {
  height: 100%;
  width: 90%;
  overflow: auto;
  margin: 0 auto;
}
header {
  height: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 0.22rem;
  box-sizing: border-box;
  background-color: #ffffff;
  margin-bottom: 0.2rem;
}

header i {
  flex: 1;
  font-size: 0.48rem;
}
header div {
  flex: 1;
  font-size: 0.32rem;
  font-weight: bold;
  text-align: center;
}
</style>
